package com.tools.wenjuanxing.tools;

import org.openqa.selenium.chrome.ChromeOptions;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;


@Component
public class selemiumApi {
    public static WebDriver driver(String url, String drivername, String business) {
        System.setProperty("webdriver.chrome.driver", "C:\\chromedriver.exe");
        ChromeOptions options = new ChromeOptions();
        options.addArguments("--proxy-server=127.0.0.1:8080");
        ChromeDriver chromeDriver = new ChromeDriver(options);
        try {
            ((WebDriver) chromeDriver).get(url);
            return chromeDriver;
        } catch (Exception e) {
            System.out.println("error");
        }
        return null;
    }
}
